<template>
  <div class="app-container">
    <!--  {{this.$route.params.courseId}} -->
    <el-form ref="form" :model="form" label-width="100px">
      <el-form-item label="CourseCode">
        <el-input v-model="form.courseCode" />
      </el-form-item>
      <el-form-item label="CourseName">
        <el-input v-model="form.courseName" type="textarea" />
      </el-form-item>
      <el-form-item label="StudentId">
        <el-input v-model="form.studentId" type="textarea" />
      </el-form-item>
      <el-form-item label="StudentName">
        <el-input v-model="form.studentName" type="textarea" />
      </el-form-item>
      <el-form-item label="UsualSorce">
        <el-input v-model="form.usualSorce" type="textarea" />
      </el-form-item>
      <el-form-item label="FinalSorce">
        <el-input v-model="form.finalSorce" type="textarea" />
      </el-form-item>
      <el-form-item label="TotalSorce">
        <el-input v-model="form.totalSorce" type="textarea" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit(form)">确认修改</el-button>
        <el-button @click="onCancel">取消修改</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

import { updateRow } from "../../../api/grade/studentGradeTable";

export default {
  data() {
    return {
      form: {
        courseCode: "",
        courseName: "",
        studentId: "",
        studentName: "",
        usualSorce:"",
        finalSorce:"",
        totalSorce:""
      }
    };
  },
  methods: {
    // fatchDataById() {
    //   var courseId = this.$route.params.courseId;
    //   var vm = this;
    //   this.axios({
    //     methods: "GET",
    //     url: "http://localhost:8080/course-web/studentGrade/getStudentGrade?courseId" +
    //       courseId  
    //   }).then(function(resp) {
    //     vm.CA = resp.data;
    //   });
    // }
      onSubmit(form) {
       updateRow().then((res) => {
        console.log(res);
        //console.log(this.form);
        alert("hhhhh")
      });

      this.$message('submit!');
      //console.log(this.form)
    },
    onCancel() {
      this.$message({
        message: 'cancel!',
        type: 'warning'
      })
    } 
  }
};
</script>

<style scoped>
.line {
  text-align: center;
}
</style>